package com.ssi.dao.user.impl;

import java.util.List;
import java.util.Map;

import com.ssi.common.CommonDao;
import com.ssi.dao.user.UserDao;
import com.ssi.domain.shop.Shop;
import com.ssi.domain.user.User;

public class UserDaoImpl extends CommonDao implements UserDao {
	private final String addUser = "user.addUser";
	private final String updateUser = "user.updateUser";
	private final String deleteUser = "user.deleteUser";
	private final String queryUserById = "user.queryUserById";
	private final String queryAllUser = "user.queryAllUser";
	private final String login = "user.login";
	

	public void addUser(User user) {
		sqlSessionTemplate.insert(addUser, user);

	}

	public void updateUser(User user) {
		sqlSessionTemplate.update(updateUser, user);
	}

	public void deleteUser(int id) {
		sqlSessionTemplate.delete(deleteUser, id);
	}

	public User queryUserById(int id) {
		return sqlSessionTemplate.selectOne(queryUserById, id);
	}

	public List<User> queryAllUser() {
		return sqlSessionTemplate.selectList(queryAllUser);
	}

	public User login(Map<String,Object> map) {
		return sqlSessionTemplate.selectOne(login, map);
	}


}
